package com.ds.springbootmybatis.mapper;

import com.ds.springbootmybatis.pojo.Department;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @program: SpringBoot
 * @description:
 * @author: Dawson.Zhang
 * @create: 2020-05-12
 **/
public interface DepartmentMapper {
    @Select("select * from department")
    List<Department> getAll();

    @Select("select * from department where id = #{id}")
    Department getById(Integer id);

    @Delete("delete from department where id = #{id}")
    Integer deleteById(Integer id);
    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into department(departmentName)values(#{departmentName})")
    Integer addDept(Department department);

    @Update("update department set departmentName=#{departmentName} where id = #{id}")
    Integer updateDept(Department department);
}
